﻿#ifndef CAMERA_BASE_H
#define CAMERA_BASE_H

#ifdef _WIN32
#include <Windows.h>
#endif

#ifdef __linux__
typedef unsigned int HWND;
#endif

typedef enum
{
    H264_CAMERA,
    TMCC_CAMERA,
    HIK_CAMERA,
    DAHUA_CAMERA,
    FFMPEG_CAMERA,
    IMOS_CAMERA,
    SZ_LPR_CAMERA,
    ICE_CAMERA,
    UNIVIEW_CAMERA
} CAMERA_TYPE;

// type: 0: RGB24, 1: YV12, 2: YV12 (转换后需要对调R通道和B通道)
typedef void(*VideoDataCallback)(int port, unsigned char *buffer, int size, int width, int height, int type, void *context);

typedef void(*ANPRInfoCallback)(int port, const char *licensePlateNumber, unsigned char* buffer, int size, int width, int height, void *context);

#ifdef DLL_EXPORT
class _declspec(dllexport) CameraBase
#else
class CameraBase
#endif
{
public:
    CameraBase();

    virtual void SetCallback(VideoDataCallback callback, void *context) = 0;
    virtual int Connect() = 0;
    virtual int Disconnect() = 0;
    static void YV12_RGB24(unsigned char* pYV12, unsigned char* pRGB24, int width, int height);

    int handle;
    CAMERA_TYPE type;
};

#endif
